<template>
	<view class="card" @click="navigateToDetail">
		<text class="title">{{ title }}</text>
		<view class="content-row">
			<image class="image" :src="image"></image>
			<view class="content-container">
				<text class="description">{{ description }}</text>
				<view class="footer">
					<!-- <text class="iconfont icon-time "></text> -->
					<u-icon name="clock-fill" color="#666" size="14"  ></u-icon>
					<text class="date">{{ date }}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getSciNew
	} from '@/api/system/sci';
	
	export default {
		props: {
			id: {
				type:  Number,
				required: false,
			},
			title: {
				type: String,
				required: true,
			},
			image: {
				type: String,
				required: true,
			},
			description: {
				type: String,
				required: true,
			},
			date: {
				type: String,
				required: true,
			},
		},
		
		
		methods: {
			navigateToDetail( ) {
				
				const id = this.id; // 获取 id
				console.log(id);
				//let id=this.id;
				this.$tab.navigateTo(`/pages/food/food?id=${id}`);
			}
		}
		
	}
	
</script>

<style scoped>
	.card {
		background-color: white;
		border-radius: 8px;
		box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
		padding: 16px;
		margin-bottom: 16px;
		margin-top: 20px;
	}

	.title {
		font-size: 18px; padding-top: 0px;padding-bottom: 0px; display: block;
		font-weight: bold;  
		width: 100%;
		margin-top: 0px;
		/* Increased top margin */
		margin-bottom: 0px;
		/* Increased bottom margin */
		height: 36px;
		line-height: 24px;
	}

	.content-row {
		display: flex;
		flex-direction: row;
	}

	.image {
		flex: 1;
		width: 40%;
		height: auto;
		border-radius: 4px;
		margin-right: 16px;
		min-height: 80px;
	}

	.content-container {
		flex: 2;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
	}

	.description {
		font-size: 14px;
		color: #555;
		margin-bottom: 12px;
	}

	.footer {
		display: flex;
		align-items: center;
	}

	.iconfont {
		font-size: 16px;
		margin-right: 8px;
	}

	.date {
		font-size: 12px;
		color: #888; margin-left: 5px;
	}
</style>